package com.ftg.learn.chapter04;

/**
 * 学习一个循环的结束
 *
 * @author kangjx
 * @version 1.0
 * @date 2023/5/20 上午9:41
 */
public class LearnContinueBreak {

    //结束一个循环有几个方法

    //break; return ; exception

    //结速当次循环呢
    //continue;


    public static void for1() {
        for (int i = 0, len = 10; i < len; i++) {
            if (i == 6) {
                continue;
            }
            System.out.print(i + "\t");
        }

        System.out.println("");
    }

    public static void for2() {
        y: for (int i = 0; i < 5; i++) {
            for (int i1 = 0, len = 10; i1 < len; i1++) {
                if (i1 == 6) {
                    //直接跳出最近的for循环
                    System.out.println();
                    continue y;
                }
                System.out.print(i1 + "\t");
            }
        }

    }

    public static void main(String[] args) {
        for2();
    }


}
